package com.shiwaixiangcun.customer.module.property

import android.annotation.SuppressLint
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.shiwaixiangcun.customer.R
import com.shiwaixiangcun.customer.entity.PropertyPaymentDetailEntity


import com.shiwaixiangcun.customer.utils.DateUtil
import kotlinx.android.synthetic.main.fragment_pay_success.*

/**
 * Author   Administrator
 * Date     2018/4/18
 * Desc     eg
 */

private const val DATA = "data"

class PaySuccessFragment : Fragment() {

    private var mData: PropertyPaymentDetailEntity? = null
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val view = inflater.inflate(R.layout.fragment_pay_success, container, false)
        return view
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initBundleData()
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initView()
    }

    @SuppressLint("SetTextI18n")
    private fun initView() {
//        tv_next_time.text = "下期账单将于${mData?.nextStatementDate}生成"
        tv_house_name.text = mData?.house
        tv_property_name.text = mData?.property
        tv_desc.text = "最近已缴费￥${mData?.unsettledAmount} | 缴费时间 ${DateUtil.getCurDateStr("yyyy-MM-dd")}"


    }

    private fun initBundleData() {
        arguments?.let {
            mData = it.getParcelable(DATA)
        }


    }

    companion object {

        @JvmStatic
        fun newInstance(data: PropertyPaymentDetailEntity) =
                PaySuccessFragment().apply {
                    arguments = Bundle().apply {
                        putParcelable(DATA, data)

                    }
                }
    }


}
